package com.checkin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.checkin.model.Person;

@Controller
public class VisitorController {

	@RequestMapping(value="/visitor", method=RequestMethod.GET)
	public String getVisitor(Model model){
		
		model.addAttribute("person", new Person());
		
		return "visitor";
	}
	
	@RequestMapping(value="/visitor", method=RequestMethod.POST)
	public String checkinVisitor(Person person,Model model){
		
		System.out.println("First Name2 " + person.getFirstName());
		System.out.println("Company Name: " + person.getCompany().getCompanyName());
		
		return "visitor";
	}
	
}
